Skip to content

Introducing the Observer pattern to SQL execution - #2939

Open
lcavadas wants to merge 2 commits into
micronaut-projects:4.13.xfrom
lcavadas:sql-execution-observer
Open

Introducing the Observer pattern to SQL execution#2939
lcavadas wants to merge 2 commits into
micronaut-projects:4.13.xfrom
lcavadas:sql-execution-observer

Conversation

@lcavadas

Copy link
Copy Markdown
Contributor

Externalising the QUERY_LOG as an observer so the same mechanism can be used for adding the query information to Spans (tracing)

@graemerocher

Copy link
Copy Markdown
Contributor

Seems like a good idea but needs tests

@lcavadas

Copy link
Copy Markdown
Contributor Author

@graemerocher Added tests for the usual suspects (CRUD) and also added a test for @Query annotated methods.

@graemerocher

Copy link
Copy Markdown
Contributor

I wonder if it makes sense to instrument the DataSource rather than the repository implementation //cc @dstepanov @radovanradic

@dstepanov

Copy link
Copy Markdown
Contributor

That would require introspecting statements. We have some other issue requesting combining parameters binding logging with the query, so maybe this can be combined.

@graemerocher

Copy link
Copy Markdown
Contributor

good point, but we should probably at least enhance JdbcOperations to log no?

@dstepanov

Copy link
Copy Markdown
Contributor

What do you mean by enhance?

@lcavadas

Copy link
Copy Markdown
Contributor Author

@dstepanov I took a peek at that other issue you mentioned and while this mechanism would definitely work for that we would need to add some sort of trigger/done function to the observers in order to perform the actual logging. As I am not that familiar with this codebase I am unsure of where that trigger should actually happen. That said I'm happy to add it if you point me in the general direction of where you think it would be best to do it.

@lcavadas
lcavadas force-pushed the sql-execution-observer branch from 95890d9 to 37b9a9f Compare June 11, 2024 18:47
@lcavadas
lcavadas force-pushed the sql-execution-observer branch from 37b9a9f to 20487e7 Compare September 3, 2024 11:55
@CLAassistant

CLAassistant commented Sep 3, 2024

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@lcavadas
lcavadas changed the base branch from 4.8.x to 4.9.x September 3, 2024 11:57
@sdelamo
sdelamo changed the base branch from 4.9.x to 4.13.x June 17, 2025 06:58
@sdelamo
sdelamo requested a review from radovanradic June 17, 2025 06:58
@sdelamo
sdelamo requested a review from dstepanov June 17, 2025 06:58
@sdelamo sdelamo moved this to Ready for Review in 4.9.0 Release Jun 17, 2025
@sdelamo sdelamo removed this from 4.9.0 Release Jun 19, 2025
@sdelamo sdelamo removed this from 4.10.0 Release Oct 20, 2025
@sdelamo sdelamo removed this from 5.0.0 Release Apr 29, 2026
@sdelamo sdelamo removed this from 5.1.0 Release Jul 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

5 participants